package com.hex.ds.hdtp.core.app.data.contrast.service.impl;

import com.hex.ds.hdtp.core.app.data.contrast.converter.ICrossDbContrastResultConverter;
import com.hex.ds.hdtp.core.app.data.contrast.dto.request.CrossDbContrastResultRequestDto;
import com.hex.ds.hdtp.core.app.data.contrast.dto.response.CrossDbContrastResultResponseDto;
import com.hex.ds.hdtp.core.app.data.contrast.service.ICrossDbContrastResultService;
import com.hex.ds.hdtp.core.inf.data.contrast.repository.ICrossDbContrastResultRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.data.contrast.service.impl
 * @ClassName CrossDbContrastResultService
 * @Description: 跨库比对清单对比结果-业务接口实现
 * @Author: wz.li
 * @Date 2023/7/25 19:37
 * @Version v2.0.2
 **/
@Slf4j
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CrossDbContrastResultService implements ICrossDbContrastResultService {

    private final ICrossDbContrastResultRepository crossDbContrastResultRepository;

    private final ICrossDbContrastResultConverter converter;

    /*
     * @Method: add <br>
     * @Param: [crossDbContrastResultRequestDto] <br>
     * @Return: int <br>
     * @Description：新增<br>
     * @Author： wz.li<br>
     * @Date： 2023/7/25 19:37 <br>
     * @Version： V2.0.2<br>
     */
    @Override
    public int add(CrossDbContrastResultRequestDto crossDbContrastResultRequestDto) {
        return crossDbContrastResultRepository.add(converter.toCrossDbContrastResultPo(crossDbContrastResultRequestDto));
    }

    /*
     * @Method: queryList <br>
     * @Param: [contrastListPkId, contrastVersion] <br>
     * @Return: java.util.List<com.hex.ds.hdtp.core.app.data.contrast.dto.response.CrossDbContrastResultResponseDto> <br>
     * @Description：根据转换清单主键和版本查询<br>
     * @Author： wz.li<br>
     * @Date： 2023/7/25 19:37 <br>
     * @Version： V2.0.2<br>
     */
    @Override
    public List<CrossDbContrastResultResponseDto> queryList(String contrastListPkId, String contrastRunLogPkId) {
        return converter.toCrossDbContrastResultResponseDtoList(crossDbContrastResultRepository.queryList(contrastListPkId, contrastRunLogPkId));
    }
}
